

#include "interrupt_sam_nvic.h"
#include "sam3xa.h"
#include "uhc.h"
#include "udc.h"
#include "time_mgr.h"
#include "io_mgr.h"
#include "common_api.h"
#include "dev_status.h"

//! Global NVIC interrupt enable status (by default it's enabled)
volatile bool g_interrupt_enabled = true;

void TC0_Handler(void)
{
    system_timer_interrupt();
}

void WDT_Handler(void)
{
    restore_battery_power(false, false);
    reset_system();
}

void UOTGHS_Handler(void)
{
    bool b_mode_device;

    b_mode_device = Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD);
    // Redirection to host or device interrupt
    if (b_mode_device) 
    {
        usb_device_interrupt();
    } 
    else 
    {
        usb_host_interrupt();
    }
}




